#ifndef CONNECTOR_THREAD_H
#define CONNECTOR_THREAD_H

#include <defs/export.h>
#include <defs/global.h>
#include "common.h"

#include <QtCore>

namespace Opl
{
	namespace Helpers
	{

		O_PRIVATE_DECLARE(ConnectorThread);
		class ConnectorThread : public QThread
		{
				Q_OBJECT
				LOG4QT_DECLARE_QCLASS_LOGGER;
			public:
				virtual ~ConnectorThread();

				static ConnectorThread* instance();

				void Setup (const ConnectorSetup& setup);
				void Send(const QString& data);

			signals:
				void connected();
				void disconnected();

			public slots:
				void stop();

			private slots:
				void clientConnected();
				void clientDisconnected();

			protected:
				void run();


			private:
				ConnectorThread(QObject* parent = 0);
				O_PRIVATE_DECLARE_MEMBER(ConnectorThread);
		};

	}
}

#endif // CONNECTOR_THREAD_H

